package com.xzh.wms.dao;

import cn.xzh.smart.core.annotataion.PageX;
import com.xzh.wms.entity.InventoryBatch;
import com.xzh.wms.entity.InventoryBatchQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

 /**
 * 库存批次;(206_inventory_batch)表数据库访问层
 * @author : heimi
 * @date : 2024-11-29
 */
@Mapper
public interface InventoryBatchDao {
 
    @PageX
    List<InventoryBatch> select(InventoryBatchQuery query);
    Integer insert(InventoryBatch inventoryBatch);
    Integer insertBatch(List<InventoryBatch> entities);
    Integer update(InventoryBatch inventoryBatch);
    Integer delete(Integer id);

    @Update("update 206_inventory_batch set qty = qty+#{qty},version=version+1 where batchId = #{batchId} and version = #{version}")
    Integer updateQty(int qty,String batchId,int version);
     @Update("update 206_inventory_batch set qty = qty-#{outQty},version=version+1 where batchId = #{batchId} and version = #{version}")
     Integer updateOutQty(Integer outQty, String batchId, Integer version);
 }